/**
 * @file ascend_inpackage_hal.h
 *
 * Copyright (c) Huawei Technologies Co., Ltd. 2012-2019. All rights reserved.
 * Description:
 * Author: huawei
 * Create: 2020-06-13
 * @brief driver interface.
 * @version 1.0
 *
 */
 
#ifndef __ASCEND_INPACKAGE_HAL_H__
#define __ASCEND_INPACKAGE_HAL_H__

#include <stdint.h>
#include "ascend_hal.h"

#ifdef __cplusplus
extern "C" {
#endif

enum devdrv_process_cp_type {
    DEVDRV_PROCESS_CP1 = 0,
    DEVDRV_PROCESS_CP2,
    DEVDRV_PROCESS_CPTYPE_MAX,
};

struct drvBindHostpidInfo {
    pid_t host_pid;
    uint32_t chip_id;
    int32_t mode;
    enum devdrv_process_cp_type cp_type;
    uint32_t len;
    char sign[PROCESS_SIGN_LENGTH];
};

/**
* @ingroup driver
* @brief Bind Device custom-process to aicpu-process
* @attention Must have a paired hostpid and a paired aicpupid
* @param [in] info  See struct drvBindHostpidInfo
              host_pid: hops pid
              chip_id:  chip id
              mode:     mode, onlinde:0, offline:1
              cp_type:  type of custom-process
              len:      lenth of sign
              sign:     sign of hostpid
* @return DRV_ERROR_NONE : success
* @return DRV_ERROR_XXX : bind fail
*/
DLLEXPORT drvError_t drvBindHostPid(struct drvBindHostpidInfo info);
/**
* @ingroup driver
* @brief Bind Device custom-process to aicpu-process
* @attention Must have a paired hostpid and a paired aicpupid
* @param [in] hostpid Paired host side pid
* @param [in] aicpupid Paired aicpu process pid
* @return DRV_ERROR_NONE : success
* @return DRV_ERROR_XXX : bind fail
*/
DV_ONLINE DVresult halMemBindSibling(int hostPid, int aicpuPid);
/**
 * @ingroup driver
 * @brief get borad id
 * @attention This function is only can be called by components in driver of device,
 *  if the components is not in driver of device, don't use this function.
 * @param [out] board_id  board id number
 * @return   0   success
 * @return   -1  fail
 */
int devdrv_get_board_id(unsigned int *board_id);

#ifdef __cplusplus
}
#endif
#endif

